﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using Microformats.Controls;
using System.ComponentModel;
using System.Web.UI;
using System.ComponentModel.Design;
using System.Drawing.Design;
using System.Web;
using System.Web.UI.WebControls;
using Microformats.Enums;

namespace Microformats.Controls
{
    public class Skype : Messaging
    {
        public SkypeAction Action { get; set; }
        public string NameOrNumber { get; set; }

        public override void Render(ref HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "url");
            switch (Action)
            {
                case SkypeAction.Chat:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("skype:{0}?chat", NameOrNumber));
                    break;
                case SkypeAction.Call:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("skype:{0}?call", NameOrNumber));
                    break;
                case SkypeAction.Add:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("skype:{0}?add", NameOrNumber));
                    break;
                case SkypeAction.Profile:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("skype:{0}?userinfo", NameOrNumber));
                    break;
                case SkypeAction.SendFile:
                    writer.AddAttribute(HtmlTextWriterAttribute.Href, string.Format("skype:{0}?sendfile", NameOrNumber));
                    break;
                default:
                    break;
            }
            
            writer.RenderBeginTag(HtmlTag);
            writer.Write("Skype");

            writer.RenderEndTag();
        }
    }
}
